<!--商城首页-->
<template>
  <div class="home">
    <div class="hero-section">
      <h1>手机商城</h1>
      <p>精选手机，品质保证</p>
    </div>
    
    <div class="products-section">
      <h2>热门商品</h2>
      <div class="products-grid">
        <ProductCard 
          v-for="product in products" 
          :key="product.id" 
          :product="product"
        />
      </div>
    </div>
  </div>
</template>

<script setup>
import { computed } from 'vue'
import ProductCard from '../components/ProductCard.vue'
import { useProductsStore } from '../stores/products'

const productsStore = useProductsStore()
const products = computed(() => productsStore.products)
</script>

<style scoped>
.home {
  min-height: 100vh;
}

.hero-section {
  background: linear-gradient(135deg, #007acc 0%, #005c99 100%);
  color: white;
  text-align: center;
  padding: 80px 20px;
  margin-bottom: 40px;
}

.hero-section h1 {
  font-size: 3rem;
  font-weight: bold;
  margin: 0 0 16px 0;
}

.hero-section p {
  font-size: 1.2rem;
  margin: 0;
  opacity: 0.9;
}

.products-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.products-section h2 {
  font-size: 2rem;
  font-weight: bold;
  margin-bottom: 30px;
  text-align: center;
  color: #333;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

@media (max-width: 768px) {
  .hero-section h1 {
    font-size: 2rem;
  }
  
  .hero-section p {
    font-size: 1rem;
  }
  
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
  }
}
</style> 